package org.beholder;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.io.IOUtils;
import org.apache.log4j.Logger;

public class PreviewServlet extends AbstractServlet {

	Logger logger = Logger.getLogger(ImageServlet.class);
	
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//    	InputStream is = getImageStream();
//    	OutputStream os = resp.getOutputStream();
//    	IOUtils.copy(is, os);
//    	IOUtils.closeQuietly(is);
//    	IOUtils.closeQuietly(os);

        OutputStream os = resp.getOutputStream();
        os.write(getPreviewBytes());
        os.close();
        closeResources();
    }

}
